package com.zhuoyue.biz.core.command.cmd.common.faa.base;

import com.zhuoyue.common.constant.ControlType;

/**
 * d:(一般所指的是延时，但是由于硬件是按照数据帧格式做功能操作，所以d:也可以指多一位)
 *
 * @author wjming
 */
public enum IndexWay {
    //一路
    oneWay("1", "00018000"),
    //一路延时
    oneWayDelayed("1d", "00038000"),
    //二路
    twoWay("2", "000C0000"),
    //二路延时
    twoWayDelayed("2d", "001C0000"),
    //三路
    threeWay("3", "00600000"),
    //三路延时
    threeWayDelayed("3d", "00E00000"),
    //四路
    fourWay("4", "03000000"),
    //四路延时
    fourWayDelayed("4d", "07000000");

    private String code;
    private String childOd;

    IndexWay(String code, String childOd) {
        this.code = code;
        this.childOd = childOd;
    }

    public String getCode() {
        return code;
    }

    public String getChildOd() {
        return childOd;
    }


    /**
     * 根据Key得到枚举的Value
     * 普通for循环遍历，比较判断
     *
     * @param key
     * @return
     */
    public static String getEnumType(String key) {
        IndexWay[] alarmGrades = IndexWay.values();
        for (int i = 0; i < alarmGrades.length; i++) {
            if (alarmGrades[i].getCode().equals(key)) {
                return alarmGrades[i].getChildOd();
            }
        }
        return "1";
    }

}
